<template>
	<div class="Directory">
		<div class="DirectoryText">
			测试目录
		</div>
		<div>
			<u-search :showAction="true" actionText="确认" v-model.trim="liveID" @custom="searchValue" :animation="true"
				placeholder="请输入测试直播间ID"></u-search>
		</div>
		<div class="DirectoryCont">
			<u-cell size="large" :title="ite.name" value="前去测试" isLink @click='routerEvent(ite.url)'
				v-for="(ite,idx) in list" :key="idx"></u-cell>
		</div>

		<div class="Directory">
			<u-search :showAction="true" actionText="确认" v-model.trim="token" @custom="searchToken" :animation="true"
				placeholder="修改程序token"></u-search>
		</div>

	</div>
</template>

<script>
	export default {
		data() {
			return {
				value: '1812409421070868480',
				token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjEyMDUwOTQsImlhdCI6MTcyMDYwMDI5NCwidXNlcklkIjoxNzY1OTc5NTM2Mzg3NzM5NjQ4fQ.T_Tv5i0d5Giz0WnNAjf8UjeeaFfhZNe7LbVrDvisUtI',
				list: [{
						name: '红包列表',
						url: '/pages/redPacket/index'
					},
					{
						name: '抽奖列表',
						url: '/pages/prizeDraw/index'
					},
					{
						name: '观看奖励',
						url: '/pages/watchReward/index'
					},
					{
						name: '优惠券',
						url: '/pages/coupon/index'
					},
					{
						name: '直播数据',
						url: '/pages/endLive/index'
					},
					{
						name: '我的设置',
						url: '/pages/mySet/index'
					},
					{
						name: '实名认证',
						url: '/pages/certification/index'
					},
					{
						name: '组织信息',
						url: '/pages/organizationInfo/index'
					},

					{
						name: '修改密码',
						url: '/pages/editPassword/index'
					},
					{
						name: '流量信息(二期)',
						url: '/pages/trafficStatistics/index'
					},
					{
						name: '新增优惠券(二期)',
						url: '/pages/couponList/index'
					},
					{
						name: '新增抽奖(二期)',
						url: '/pages/lottery/index'
					},
					{
						name: '观众列表(二期)',
						url: '/pages/userList/index'
					},
					{
						name: '推广员工(二期)',
						url: '/pages/ExtensionOfficer/index'
					},
					{
						name: '直播管理(二期)',
						url: '/pages/LiveConfig/index'
					},
					{
						name: '直播数据(二期)',
						url: '/pages/endLive/liveData'
					},
				],
			}
		},
		onShow() {
			this.liveID = uni.getStorageSync('csValue') || '1812788388055486464'
			this.token = uni.getStorageSync('b-token') ||
				'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjEyMDUwOTQsImlhdCI6MTcyMDYwMDI5NCwidXNlcklkIjoxNzY1OTc5NTM2Mzg3NzM5NjQ4fQ.T_Tv5i0d5Giz0WnNAjf8UjeeaFfhZNe7LbVrDvisUtI'
		},
		onPullDownRefresh() {
			uni.stopPullDownRefresh()
		},
		methods: {
			//test
			routerEvent(ite) {
				if (!this.liveID) return uni.showToast({
					title: '请输入直播间ID再进行测试！',
					icon: 'none'
				})
				uni.navigateTo({
					url: ite + "?liveId=" + this.liveID
				})
			},
			searchValue() {
				uni.setStorageSync('csValue', this.liveID)
				uni.showToast({
					title: '直播间ID修改成功',
					icon: 'none'
				})
			},
			searchToken() {
				uni.setStorageSync('b-token', this.token)
				uni.showToast({
					title: 'Token修改成功',
					icon: 'none'
				})
			}
		}
	}
</script>

<style lang="scss">
	.Directory {
		padding: 20rpx;
		box-sizing: border-box;
		background: #fff;
	}

	.DirectoryText {
		text-align: center;
		font-size: 16px;
		font-weight: 700;
		margin-bottom: 20px;
	}

	.DirectoryCont {
		margin-top: 24rpx;
	}
</style>